/*
 *  Segment.h
 *  openFrameworks
 *
 *  Created by allesblinkt on 5/4/09.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *
 */

#include "Point2f.h"



#ifndef __ABLIEFERN_SEGMENT
#define __ABLIEFERN_SEGMENT

namespace abliefern {
	
	class Segment {
	public:
		float x1;
		float y1;
		
		float y2;
		float x2;
		
		
		
		
		Segment();
		Segment(float theX1, float theY1, float theX2, float theY2);
		
		
		Point2f* intersect(Segment* theSegment);
		float distanceToPoint(Point2f* thePoint);
		float distanceToPoint(float theX, float theY);
		
		float squaredDistanceToPoint(Point2f* thePoint);
		float squaredDistanceToPoint(float theX, float theY);
		
		float magnitude();
		float squaredMagnitude();
		
		static Point2f* intersect(Segment* theSegment1, Segment* theSegment2); 
		static float distanceToPoint(Segment* theSegment, Point2f* thePoint);
		static float distanceToPoint(Segment* theSegment, float theX, float theY);
		
		static float squaredDistanceToPoint(Segment* theSegment, Point2f* thePoint);
		static float squaredDistanceToPoint(Segment* theSegment, float theX, float theY);
		
		static float magnitude(float theX1, float theY1, float theX2, float theY2);
		static float squaredMagnitude(float theX1, float theY1, float theX2, float theY2);

		float angle();
	};
}
#endif


